package com.vvitt.kotlinhiltcarhome.di

import com.vvitt.kotlinhiltcarhome.db.CarBrandDataBase
import com.vvitt.kotlinhiltcarhome.mapper.Entity2ItemModelMapper
import com.vvitt.kotlinhiltcarhome.net.CarBrandApi
import com.vvitt.kotlinhiltcarhome.repository.BaseRepository
import com.vvitt.kotlinhiltcarhome.repository.CarBrandRepositoryImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.hilt.android.scopes.ActivityScoped

/**
 * @author please call me police uncel
 * @since 2023/5/26
 * @email 110
 * @desciption Repositorymodule 自动注入
 **/
@InstallIn(ActivityComponent::class)
@Module
object RepositoryModule {

    @ActivityScoped
    @Provides
    fun provideCarBrandRepository(
        api: CarBrandApi,
        database: CarBrandDataBase
    ): BaseRepository {
        return CarBrandRepositoryImpl(api, database, Entity2ItemModelMapper())
    }
}
